#pragma once
#ifndef PDF_OBJECT_HPP
#define PDF_OBJECT_HPP
#include "ObjectType.hpp"
#include "ObjectReference.hpp"
#include "ObjectRange.hpp"
#include "StringValue.hpp"

namespace Pdf
{
    struct NameNode;
    struct Stream;

    class Object
    {
    public:
                                Object();
                                Object(ObjectRange const & objectRange, ObjectType objectType);
                                Object(unsigned int identifier, unsigned int generation);
                                Object(bool value);
                                Object(int value);
                                Object(double value);
                                Object(StringValue const & value);
                                Object(NameNode const * value);
                                Object(Stream const * value);

        ObjectType              getType() const;
        
        bool                    getBoolean() const;
        int                     getInteger() const;
        double                  getReal() const;
        StringValue const &     getString() const;
        NameNode const *        getName() const;
        ObjectRange const &     getArray() const;
        ObjectRange const &     getDictionary() const;
        Stream const *          getStream() const;
        ObjectReference const & getIndirect() const;

    private:
        ObjectType type;
        union
        {
            bool                valueBoolean;
            int                 valueInteger;
            double              valueReal;
            StringValue         valueString;
            NameNode const *    valueName;
            ObjectRange         valueArray;
            ObjectRange         valueDictionary;
            Stream const *      valueStream;
            ObjectReference     valueIndirect;
        };
    };
}

#endif // PDF_OBJECT_HPP
